Visualize Latest Observations from the Ambient Weather Stations#
Imports#
import glob
import xarray as xr
from bokeh.models.formatters import DatetimeTickFormatter
import hvplot.xarray
import holoviews as hv
from distributed import Client
import warnings
warnings.filterwarnings("ignore")
hv.extension('bokeh')
Start up a Dask Cluster#
client = Client()
client
/Users/mgrover/miniforge3/envs/pyart-dev/lib/python3.10/site-packages/distributed/node.py:182: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 62193 instead
warnings.warn(
Client
Client-a9c70a40-ca67-11ed-a465-520a01803a93
| Connection method: Cluster object | Cluster type: distributed.LocalCluster |
| Dashboard: http://127.0.0.1:62193/status |
Cluster Info
LocalCluster
14fb2ca2
| Dashboard: http://127.0.0.1:62193/status | Workers: 5 |
| Total threads: 10 | Total memory: 32.00 GiB |
| Status: running | Using processes: True |
Scheduler Info
Scheduler
Scheduler-32e74498-5b60-4d01-b2b2-48435e9839ba
| Comm: tcp://127.0.0.1:62194 | Workers: 5 |
| Dashboard: http://127.0.0.1:62193/status | Total threads: 10 |
| Started: Just now | Total memory: 32.00 GiB |
Workers
Worker: 0
| Comm: tcp://127.0.0.1:62210 | Total threads: 2 |
| Dashboard: http://127.0.0.1:62220/status | Memory: 6.40 GiB |
| Nanny: tcp://127.0.0.1:62197 | |
| Local directory: /var/folders/bw/c9j8z20x45s2y20vv6528qjc0000gq/T/dask-worker-space/worker-ah0ror6r | |
Worker: 1
| Comm: tcp://127.0.0.1:62211 | Total threads: 2 |
| Dashboard: http://127.0.0.1:62215/status | Memory: 6.40 GiB |
| Nanny: tcp://127.0.0.1:62198 | |
| Local directory: /var/folders/bw/c9j8z20x45s2y20vv6528qjc0000gq/T/dask-worker-space/worker-cszeg5h6 | |
Worker: 2
| Comm: tcp://127.0.0.1:62208 | Total threads: 2 |
| Dashboard: http://127.0.0.1:62212/status | Memory: 6.40 GiB |
| Nanny: tcp://127.0.0.1:62199 | |
| Local directory: /var/folders/bw/c9j8z20x45s2y20vv6528qjc0000gq/T/dask-worker-space/worker-b7fz0w8k | |
Worker: 3
| Comm: tcp://127.0.0.1:62207 | Total threads: 2 |
| Dashboard: http://127.0.0.1:62214/status | Memory: 6.40 GiB |
| Nanny: tcp://127.0.0.1:62200 | |
| Local directory: /var/folders/bw/c9j8z20x45s2y20vv6528qjc0000gq/T/dask-worker-space/worker-f0xi4ogn | |
Worker: 4
| Comm: tcp://127.0.0.1:62209 | Total threads: 2 |
| Dashboard: http://127.0.0.1:62213/status | Memory: 6.40 GiB |
| Nanny: tcp://127.0.0.1:62201 | |
| Local directory: /var/folders/bw/c9j8z20x45s2y20vv6528qjc0000gq/T/dask-worker-space/worker-spsasmdl | |
Read the Sorted Data, Using the Last File#
files = sorted(glob.glob('../../data/surface-meteorology/*/*/*/*.nc'))
ds = xr.open_mfdataset(files[-60:])
/Users/mgrover/miniforge3/envs/pyart-dev/lib/python3.10/site-packages/tqdm/auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
Plot the Data#
formatter = DatetimeTickFormatter(hours="%d %b %Y \n %H:%M UTC")
variables = ['outdoor_temperature', 'outdoor_dewpoint', 'hourlyrainin', 'solarradiation']
panels = []
for variable in variables:
panels.append(ds[variable].hvplot.line(x='time', by='station', xformatter=formatter))
hv.Layout(panels).cols(1)